# coding:utf-8
import time
import unittest
import sys
import os

sys.path.append(os.path.dirname(sys.path[0]))

from yurongtong_system_background.common import HTMLTestRunner_cn

test_dir = "E:\\Python-selenium\\yurongtong_system_background\\case"

discover = unittest.defaultTestLoader.discover(start_dir=test_dir, pattern="test*.py", top_level_dir=None)

# print(discover)

if __name__ == "__main__":
    now = time.strftime("%Y-%m-%d %H-%M-%S")
    filename = "E:\\Python-selenium\\yurongtong_system_background\\report\\" + now + "resut.html"
    fp = open(filename, "wb")
    runner = HTMLTestRunner_cn.HTMLTestRunner(stream=fp, title = u'测试报告', description = u'用例执行情况：')

    runner.run(discover)
    fp.close()